/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import React, { useState, useEffect } from "react";
import { Button, Modal, Tabs } from "antd";
import StandardTab from "@/components/StandardTab";
import Create from "./create.js";
import Download from "./download";

const { TabPane } = Tabs;

const CreateBill = props => {
  const [activeKey, setActiveKey] = useState();
  const [visible, setVisible] = useState(false);

  const openVisible = () => setVisible(true);
  const onClose = () => setVisible(false);

  return (
    <>
      <Button type="primary" onClick={openVisible}>
        生成对账单
      </Button>
      <Modal
        title={activeKey == 2 ? "下载对账单" : "生成对账单"}
        centered
        visible={visible}
        onCancel={onClose}
        maskClosable
        destroyOnClose
        width={700}
        footer={null}
      >
        <Tabs onChange={value => setActiveKey(value)}  type="card">
          <TabPane tab="生成对账单" key="1">
            <Create POST={props.POST} />
          </TabPane>
          <TabPane tab="下载对账单" key="2">
            <Download />
          </TabPane>
        </Tabs>
      </Modal>
    </>
  );
};
export default CreateBill;
